import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;



public class day230320 {
    // 排序子序列
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n + 1];
        // 防止越界, 因为输入的都是正整数, 最后也可以和0比较
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        int i = 0;
        int count = 0;
        while (i < n) {
            if (array[i] < array[i + 1]) {
                // 非递增
                while (i < n && array[i] < array[i+1]) {
                    i++;
                }
                count++;
            } else if (array[i] > array[i + 1]) {
                // 非递减
                while (i < n && array[i] > array[i+1]) {
                    i++;
                }
                count++;
            }
            i++;
        }
        System.out.println(count);
    }

    public static void main5(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
        }
        int flag = 0;
        int count = 1;
        for (int i = 1; i < n; i++) {
            if (array[i - 1] < array[i]) {
                // 非递增
                if (flag == 0) {
                    flag = 1;
                } else if (flag == -1) {
                    count++;
                    flag = 0;
                }
            } else if (array[i - 1] > array[i]){
                // 非递减
                if (flag == 0) {
                    flag = -1;
                } else if (flag == 1) {
                    count++;
                    flag = 0;
                }
            }
        }
        // 123 321
        System.out.println(count);
    }

    // 倒置字符串
    public static void reverse(char[] array, int start, int end) {
        while (start < end) {
            char ch = array[start];
            array[start] = array[end];
            array[end] = ch;
            start++;
            end--;
        }
    }
    public static void main4(String[] args) {
        Scanner sc = new Scanner(System.in);
        // 数组存储
        char[] array = sc.nextLine().toCharArray();
        // 逆置整个字符串
        reverse(array, 0, array.length - 1);
        int i = 0;
        while (i < array.length) {
            int j = i;
            while (j < array.length && array[j] != ' ') {
                j++;
            }
            // 找空格, 逆置单词
            reverse(array, i, j - 1);
            // i 下标跳到下一个单词
            i = j + 1;
        }
        String ret = new String(array);
        System.out.print(ret);
    }

    public static void main3(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();
        // 空格分割
        String[] array = str.split(" ");
        StringBuilder ret = new StringBuilder();
        for (int i = array.length - 1; i >= 0; i--) {
            ret.append(array[i]);
            ret.append(" ");
        }
        System.out.println(ret);
    }

    // 删除公共字符
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str1 = sc.nextLine();
        String str2 = sc.nextLine();
        StringBuilder ret = new StringBuilder();
        // 集合
        Set<Character> set = new HashSet<>();
        for (int i = 0; i < str2.length(); i++) {
            // 将str2的字符添加到set中
            set.add(str2.charAt(i));
        }
        for (int i = 0; i < str1.length(); i++) {
            char ch = str1.charAt(i);
            if (!set.contains(ch)) {
                // set 不存在, 说明不是要删除的字符, 拼接
                ret.append(ch);
            }
        }
        System.out.println(ret);
    }

    // 组队竞赛
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[3*n];
        for (int i = 0; i < array.length; i++) {
            array[i] = sc.nextInt();
        }
        // 排序
        Arrays.sort(array);
        long ret = 0;
        for (int i = 0; i < n; i++) {
            // 从后往前
            // 隔一个加一个, n组
            ret += array[array.length - (1 + i)*2];
        }
        System.out.println(ret);
    }
}
